package com.gi.profiler.controllers;

import android.content.Context;
import android.media.AudioManager;

public class AudioControl {

    private static AudioControl audioCtrl;
    private static AudioManager audioMgr;

    private AudioControl() {
    }

    public static AudioControl getInstance(Context ctx) {
	if (audioCtrl == null) {
	    audioCtrl = new AudioControl();
	    audioMgr = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE);
	}
	return audioCtrl;
    }

    public static AudioManager getAudioManager(Context ctx) {
	if (audioMgr == null) {
	    audioMgr = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE);
	}
	return audioMgr;
    }
    
    /**
     * @param streamType
     *            : media, system, ring, alarm, notification, voicecall
     * @param index
     *            : volume value
     * @param flags
     *            : actions associated with changing volume
     */
    public void setStreamVolume(int streamType, int index, int flags) {
	audioMgr.setStreamVolume(streamType, index, flags);
    }

    public void setRingerMode(int ringerMode) {
	audioMgr.setRingerMode(ringerMode);
    }

    public void setViberation() {
    }

}
